<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //调试代码 开发的时候常写，上线应该删除掉
        //瞬间执行完的代码
        //event loop的一个单元

        
        // console.log('start');
        // setTimeout(()=>{
        //     console.log('timeout')
        // },0)
        // // resolve 静态方法
        // Promise.resolve().then(()=>{
        //     console.log('resolve');
        // })
        // Promise.resolve().then(()=>{
        //     console.log('resolve2');
        // })
        // const p = new Promise((resolve,reject)=>{
        //     console.log('p promise instance');
        //     setTimeout(()=>{
        //         console.log('----');
        //         resolve('ddd')
        //     },1000)
        // })
        // console.log('end');
        Promise.resolve().then(()=>{
            console.log('promise1');
            setTimeout(()=>{
                console.log('settIMEOUT2')
            },0)
        })
        setTimeout(()=>{
            console.log('setTimeout1');
            Promise.resolve().then(()=>{
                console.log('promise2')
            })
        },0)
        console.log('start')
    </script>

</body>
</html>